<script setup lang="ts">
import HeaderMobileNav from '@/components/headerMobile/HeaderMobileNav.vue'
import HeaderLogo from '@/components/header/HeaderLogo.vue';
import HeaderSearch from '@/components/header/HeaderSearch.vue';
import HeaderUser from '@/components/header/HeaderUser.vue';
</script>

<template>
  <div class="app-header">
    <div class="app-header-wrap">
      <div class="header-content content-width">
        <div class="header-left">
          <!-- 导航 -->
          <HeaderMobileNav />
        </div>

        <div class="header-center">
          <!-- LOGO -->
          <HeaderLogo />
        </div>

        <div class="header-right">
          <ClientOnly>
            <!-- 搜索框 -->
            <HeaderSearch />
            <!-- 用户 -->
            <HeaderUser />
          </ClientOnly>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.app-header {
  color: var(--o-color-info1);
  background-color: var(--o-color-fill2);
  height: var(--layout-header-height);
  z-index: var(--layout-header-z-index);
  position: fixed;
  top: 0;
  &::before {
    top: 0;
    bottom: 0;
    right: 0;
    box-shadow: 0 3px 8px rgba(var(--o-mixedgray-14), 0.05);
    content: '';
    left: 0;
    pointer-events: none;
    position: absolute;
  }
}
.app-header-wrap {
  position: relative;
  height: 100%;
  width: var(--grid-layout-width);
  padding-left: var(--grid--layout-padding);
  padding-right: var(--grid--layout-padding);
  margin: 0 auto;
  z-index: var(--layout-header-z-index);
}
.header-content {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
}
.header-left,
.header-center,
.header-right {
  height: 100%;
  display: flex;
  align-items: center;
  animation: anim-header-trans-in var(--o-duration-xl);
  width: 33.33%;
  flex-grow: 1;
  flex-shrink: 0;
  gap: 12px;
  @include respond-to('phone') {
    gap: 8px;
  }
}
.header-right {
  justify-content: flex-end;
}
.header-center {
  justify-content: center;
}
@keyframes anim-header-trans-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
.header-logo {
  @include h1;
  height: 100%;
  display: flex;
  align-items: center;
  cursor: pointer;
}

@include respond-to('>pad_v') {
  .app-header {
    display: none;
  }
}
</style>
